package top.ljlgithub.api.jwt;
import org.apache.shiro.authc.AuthenticationToken;

public class JwtToken implements AuthenticationToken {

    private static final long serialVersionUID = 1L;

    // 加密后的 JWT token串,作为凭证信息
    private String token;
    //作为身份信息
    private String username;

    public JwtToken(String token) {
        this.token = token;
        this.username = JwtUtils.getClaimFiled(token, "username");
    }

    @Override
    public Object getPrincipal() {
        return this.username;
    }

    @Override
    public Object getCredentials() {
        return this.token;
    }
}